package com.crazy.crazyserviceclient.service;

import com.crazy.crazycommon.common.BaseResponse;
import com.crazy.crazymodel.model.dto.trade.TradeRequest;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.math.BigDecimal;


/**
 * @Date: 2024-05-08-13:00
 * @Author: Zheng Zeliang
 */
@FeignClient(name = "crazy-business-service", path = "/api/business/inner")
public interface BusinessFeignClient {

    /**
     * 申购后冻结金额
     * @param tradeRequest
     * @return
     */
    @PostMapping("/bankcard/pay")
    String pay(@RequestBody TradeRequest tradeRequest);

    /**
     * 按银行卡号进行赎回
     */
    @PostMapping("/bankcard/redeem")
    BaseResponse<String> redeem(@RequestBody TradeRequest tradeRequest);

    /**
     * 根据银行卡号和金额进行冻结金额的清算
     * @param
     * @return
     */
    @PostMapping("/bankcard/liquidateById")
    public BaseResponse<String> liquidateById(@RequestBody TradeRequest tradeRequest);

    /**
     * 根据产品ID获取最新净值
     */
    @PostMapping("/liquidation/dayinit")
    BigDecimal getNetWorthByProductID(@RequestParam("productID")int productID);


    /**
     * 撤单时调用接口，按金额数将冻结金额解冻
     * @param tradeRequest
     * @return
     */
    @PostMapping("/bankcard/orderChancel")
    public BaseResponse<String> freezeBalanceChancel(@RequestBody TradeRequest tradeRequest);
}
